<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>
<!--  部门列表 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
		<title>部门列表</title>
	<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
	<script src="<%=path%>/js/resizeIframe.js" type="text/javascript"></script>
	<script language="javascript" src="<%=path %>/js/syAjax.js"></script>
	<script type="text/javascript">
      	window.onload = function(){
	    parent.location.hash="top";
      	
      	resizeIframe();
        new Anim.DD($("items"), $("title"));
		$("items").style.left = 10;
		$("items").style.top = 10;
		new Anim.DD($("tempDiv"), $("temptitle"));
		$("tempDiv").style.left = 10;
		$("tempDiv").style.top = 10;
          
        
      };
	var orgId;
	//影响透明度
	function resizeIframe(){
 		parent.resizeIframe();
 	}
 
	function doChooseUser(returnStr){
	//原版内容
	document.getElementById("tempIframe").contentWindow.doChooseUser(returnStr);
		closeSelectDIV();
	}
	function giveParamArr(){
		return document.getElementById("tempIframe").contentWindow.giveParamArr();
	}

      //显示遮罩
    function displayModuleDiv(url){
    	document.getElementById("selectUserIframe").src=url;
		document.getElementById("items").style.display = "";
		resizeIframe();	

	}
	function displayTempDiv(wth,hth){
	document.getElementById("tempDiv").style.height = hth+"px";
	document.getElementById("tempDiv").style.width = wth+"px";
		document.getElementById("tempDiv").style.display = "";	
		resizeIframe();
	}
	//关闭div
	function closeTempDiv(){
		document.getElementById("tempDiv").style.display = "none";
	}
	function closeSelectDIV(){
		document.getElementById("items").style.display = "none";
	}
	function refreshJsp(){
		window.location.href=window.location.href;
	}
      //添加部门
      function addDept()
      {
      	document.getElementById("tempName").innerHTML="添加部门";
        document.getElementById("tempIframe").src="<%=path %>/baseSet/org/addDepartment.jsp?organization.orgType=2&t="+new Date();
        displayTempDiv(400,250);

      }
      
      //修改部门
      function updateDept(orgId)
      {
      	document.getElementById("tempName").innerHTML="修改部门";
        document.getElementById("tempIframe").src="<%=path %>/findOrganizationByIdorganizationAction.action?role.roleId=bmfzr&year.yearValue=${applicationScope.currentYear}&organization.organizationId="+orgId+"&t="+new Date();
        displayTempDiv(400,250);

      }
      
      //删除部门
      function deleteDept(organizationId,orgType)
      {
        syAjax.request("post","<%=path %>/deleteByOrganizationIdorganizationAction.action","organization.organizationId="+organizationId +"&organization.orgType="+orgType+"&role.roleId=bmfzr",{success:initSuccessResult,fail:onFail,type:'plain'});
      }
      
      function initSuccessResult(response)
	      {
	        refreshJsp();
	      }
	      
	      
	 //批量添加
		function toBatchAdd() {
			document.getElementById("tempName").innerHTML="批量添加部门";
			document.getElementById("tempIframe").src="<%=path%>/baseSet/org/batchAddDepartment.jsp?t="+new Date();	
			displayTempDiv(730,500);
		}
	</script>

  </head>
  
  <body>
  <div id="contentDIV" style="position:absolute;width:100%; padding:5px; background-color:#ffffff;z-index:1;">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" class="f_5">部门设置</td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#9DD12E"></td>
  </tr>
  <tr>
    <td colspan="2" align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" align="left">
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="bottom" width="20%">
        <table width="150" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="5" align="left" valign="bottom" background="<%=path %>/images/sywesp_18.gif"><img src="<%=path %>/images/sywesp_17.gif" width="5" height="31" /></td>
            
            <td width="5" align="right" valign="bottom" background="<%=path %>/images/sywesp_18.gif"><img src="<%=path %>/images/sywesp_19.gif" width="5" height="31" /></td>
           </tr>
        </table>
        </td>    
    <td align="right" class="f_5">
        <a  href="<%=path %>/findOfficialToDepartmentorganizationAction.action?user.userType=${sessionScope.UserInfo.userType}&years=${applicationScope.currentYear}&orgType=2&forwardPage=offToDepartment">部门成员管理</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>   
      </tr>
      <tr >
        <td align="left" valign="top" class="tb_6 border_2"  colspan="2">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="91%" height="25" align="left" class="f_7">以下是已经设置的部门：</td>
            <td width="9%" align="right" nowrap="nowrap">
             
              <img src="<%=path %>/images/icon_12.gif" width="18" height="18" align="absmiddle" /> <a href="javascript:addDept();">添加部门</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:toBatchAdd();'>批量添加部门</a>
             
            </td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left" valign="top">
               <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="2" height="24" align="left" background="<%=path %>/images/sywesp_21.gif"><img src="<%=path %>/images/sywesp_20.gif" width="2" height="24" /></td>
                  <td align="left" background="<%=path %>/images/sywesp_21.gif">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="1%">&nbsp;</td>
                      <td width="13%" align="left" class="f_8">序号</td>
                      <td width="28%" align="left" class="f_8"><img src="<%=path %>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />编号</td>
                      <td width="50%" align="left" class="f_8"><img src="<%=path %>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />名称</td>
                      <td width="8%" align="center" class="f_8"><img src="<%=path %>/images/sywesp_23.gif" width="8" height="22" align="absmiddle" />操作</td>
                    </tr>
                  </table></td>
                  <td width="4" align="right" background="<%=path %>/images/sywesp_21.gif"><img src="<%=path %>/images/sywesp_22.gif" width="4" height="24" /></td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td align="left" valign="top">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="25" align="left" valign="top" class="tb_7">
                   <c:choose>
                     <c:when test="${!empty AllOrganizationByType}">
	                    <c:forEach items="${AllOrganizationByType}" var="org">
                  		<table width="100%" border="0" cellspacing="1" cellpadding="0" style="border-bottom: solid #CCCCCC 1px;">
	                      <tr onmouseover="this.style.backgroundColor='#e4f5ff'" onmouseout="this.style.backgroundColor=''">
		                      <td width="1%">&nbsp;</td>
		                      <td width="13%" height="25" align="left" valign="bottom" class="f_4">${org.sort }</td>
		                      <td width="28%" align="left" valign="bottom" class="f_4">${org.organizationId }</td>
		                      <td width="50%" align="left" valign="bottom" class="f_4">${org.name }</td>
		                      <td width="8%" valign="bottom" align="center">
		                      
		                          <a href="javascript:updateDept('${org.organizationId }');"><img src="<%=path %>/images/icon_5.gif" width="15" height="16" border="0" alt="编辑${org.name }" /></a>&nbsp;&nbsp;<a href="javascript:deleteDept('${org.organizationId }','${org.orgType }');" onclick="return window.confirm('确定删除此部门？')"><img src="<%=path %>/images/icon_11.gif" width="12" height="12" border="0" alt="删除${org.name }" /></a>		                  
		                      </td>
	                      </tr>
                  		</table>
	                    </c:forEach>
                    </c:when>
                    <c:otherwise>
                      <table width="100%" border="0" cellspacing="1" cellpadding="0">
                    	<tr>
                    	  <td colspan="5" align="center" valign="middle"><font color="#CCCCCC">暂无部门信息</font></td>
                    	</tr>
                      </table>
                    </c:otherwise>
                   </c:choose>
                    </td>
                </tr>
              </table></td>
            </tr>
        </table>
       </td>
      </tr>
      <tr>
        <td colspan="2" height="500">&nbsp;</td>
      </tr>
     </table>
       
    </td>
  </tr>
</table>
</div>
<div id="tempDiv" style="position: absolute; width: 0px;height:0px; top:100px; left:200px; padding-bottom:8px; background-color:#ECF7FD;z-index:8; border:3px solid #3A6EA5;display: none;" >
<div style="width:100%;" id="temptitle">
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="center" bgcolor="#3A6EA5">
<tr style=" height: 30px;">
<td>&nbsp;&nbsp;<font color='#FFFFFF'><span id="tempName"></span>:</font></td>
<td align="right"><a href="javascript:closeTempDiv();" style="text-decoration: none;"><span style="color: #000000; font-size:;">[关闭]</span></a></td>
</tr>
</table>
</div>
<div style="width:100%;top:100px;left:200px;height: 100%">
<iframe name="tempIframe" id="tempIframe" src="" style="width:100%;height: 100%" align="middle"  frameborder="0"></iframe>   
</div>
</div>
<div id="items" style="position: absolute; width: 730px;height:600px; top:100px; left:200px; padding-bottom:8px; background-color:#ECF7FD;z-index:10; border:3px solid #3A6EA5;display: none;" >
<div style="width:100%;top:100px;left:200px;" id="title">
<table border="0" width="100%" cellpadding="0" cellspacing="0" align="center" bgcolor="#3A6EA5">
<tr style=" height: 30px;">
<td>&nbsp;&nbsp;<font color='#FFFFFF'>请选择教师</font></td>
<td align="right"><a href="javascript:closeSelectDIV();" style="text-decoration: none;"><span style="color: #000000; font-size:;">[关闭]</span></a></td>
</tr>
</table></div>
<div style="width:100%;top:100px;left:200px;height: 100%">
<iframe name="selectUserIframe" id="selectUserIframe" src="" style="width:100%;height: 100%" align="middle"  frameborder="0"></iframe>   
</div>
</div>
  </body>
</html>

